package com.entity;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;

@Data
public class Message {
    private Integer sendUserId;

    private Integer receiveUserId;

    private String messageType;

    private String targetType;

    private Date sendTime;

    private String content;

    private MultipartFile multipartFile;

    private String fileUrl;

    private String sendUserName;

    private String sendUserHeadURL;

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        String json = null;
        try {
            json = objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
        return json;
    }
}
